package question2;

public abstract class Handler<T>
{
  protected Handler<T> successor= null;

  public Handler()
  {
    this.successor= null;
  } // Handler()

  public Handler( Handler<T> successor )
  {
    this.successor= successor;
  } // Handler()

  public void setSuccessor( Handler<T> successor )
  {
    this.successor= successor;
  } // setSuccessor()

  public Handler<T> getSuccessor()
  {
    return this.successor;
  } // getSuccessor()

  public boolean handleRequest( T value )
  {
    if ( successor == null )   return false;
    return successor.handleRequest( value );
  }
} // Handler
